package packet;

import java.io.IOException;
import socket.SocketStream;

public class PacketHandler {

	public static void sendPacketWithSocketStream(Packet packet,SocketStream socketstream){
		try {
			socketstream.getObject_output_stream().writeObject(packet);
			socketstream.getObject_output_stream().flush();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static Packet receivePacketWithSocketStream(SocketStream socketstream){
		try {
			return (Packet)socketstream.getObject_input_stream().readObject();
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			return null;
		}
	}
	
}
